package org.lee.pdf;

import org.lee.pdf.util.Pdf2HtmlUtil;

import java.io.*;

/**
 * @author jackielee
 * @version 1.0
 * @description App
 * @date 2021/6/2
 */
public class App {
  public static void main(String[] args) {
    String pdfFile = "C:\\Users\\Jackie\\Downloads\\dd\\DevOps流程建设图.pdf";
    String htmlFile = "C:\\Users\\Jackie\\Downloads\\dd\\pdf";
    Pdf2HtmlUtil.pdf2Html(pdfFile, htmlFile);
    Pdf2HtmlUtil.pdf2Png(pdfFile, htmlFile);
    try (FileInputStream in = new FileInputStream(pdfFile)) {
      String html = Pdf2HtmlUtil.base642Html(Pdf2HtmlUtil.img2Base64(Pdf2HtmlUtil.pdf2Png(in)));
      FileOutputStream out =
          new FileOutputStream(
              String.format("%s%sDevOps流程建设图.pdf.png.html", htmlFile, File.separator));
      OutputStreamWriter writer = new OutputStreamWriter(out);
      writer.write(html);
      writer.flush();
      out.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
